package jannex.label;

import java.util.Map;

class LabelEntry<V> implements Map.Entry<String, V> {

    private final String label;
    private final V v;

    LabelEntry(String label, V v) {
        this.label = label;
        this.v = v;
    }

    @Override
    public String getKey() {
        return label;
    }

    @Override
    public V getValue() {
        return v;
    }

    @Override
    public V setValue(V value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        LabelEntry that = (LabelEntry) o;
        return label.equalsIgnoreCase(that.label);

    }

    @Override
    public int hashCode() {
        return label.hashCode();
    }
}
